package com.example.jiagoujiexiang.Mapper;


import com.example.jiagoujiexiang.entity.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface commentDao {
    @Select("select * from comments")
    public List<Comment> getCommentList();

    @Insert("INSERT INTO comments (nickname, content) VALUES (#{nickname}, #{content})")
    public int insertComment(@Param("nickname") String nickname, @Param("content") String content);

    @Insert("INSERT INTO comments (nickname, content, time, thumbUpCount, parentId) VALUES (#{nickname}, #{content}, #{time}, #{thumbUpCount}, #{parentId})")
    public int insertCommentR(Comment comment);
}

